#ifndef CHUGLOBALMERCATOR_H
#define CHUGLOBALMERCATOR_H

#include "math.h"
#include <stdio.h>
#include <list>
class CHuGlobalMercator
{
public:
    CHuGlobalMercator( int tileSize);
    // 功能：
    void LatLonToMeters(double lon,double lat,double* mxy);
    void MetersToLatLon(double mx, double my, double* LatLon);
    void PixelsToMeters(double px, double py, int zoom, double* mxy);
    void MetersToPixels(double mx, double my, int zoom, double* pxy);
    void MetersToPixelclip(double mx, double my,int tx, int ty ,int zoom, double* pxy);

    void PixelsToTile(double px, double py, int* txy);
    void MetersToTile(double mx, double my, int zoom, int* txy);
    void MetersToTile2(double mx, double my, int zoom, int* txy);
    void TileBounds(int tx, int ty,int zoom, double* bound4);
    void TileBounds2(int tx, int ty,int zoom, double* bound4);
    void TileLatLonBounds(int tx, int ty,int zoom, double* LatLonbound4);
     void  PixelsToRaster(double px,double  py, int zoom ,int* bound4 );

    double Resolution(int zoom);
    int ZoomForPixelSize(double pixelSize);
    void GoogleTile(int tx, int ty,int zoom, int* txy);
    double DegreesToRadians (double fRad);

private:


    //-----------------------------------------------------------------------------------//
    double m_pi;
    int m_tileSize;
    //分辨率
    double m_initialResolution;
    //周长的一半
    double m_originShift;

    // 火星坐标与wgs84坐标互转
    double x_PI;// = 3.14159265358979324 * 3000.0 / 180.0;
    double PI;// = 3.1415926535897932384626;
    double a;// = 6378245.0;
    double ee;// = 0.00669342162296594323;



};

#endif // CHUGLOBALMERCATOR_H
